﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Share;
using Newtonsoft.Json;

namespace NewtonJsonUsage
{
    public static class SerializeObject
    {
        public static void Demo()
        {
            Console.WriteLine("序列化");

            Product product = new Product();
            product.Name = "Apple";
            product.ExpiryDate = new DateTime(2008, 12, 28);
            product.Price = 3.99M;
            product.Sizes = new string[] { "Small", "Medium", "Large" };
            string output = JsonConvert.SerializeObject(product);
            Console.WriteLine(output);
        }
    }
    //{"Name":"Apple","ExpiryDate":"2008-12-28T00:00:00","Price":3.99,"Sizes":["Small","Medium","Large"]}
}
